import java.io.*;

public class MainClass {
	
	public static void doLine(char charArray[], int n) throws IOException
	{
		File fout = new File("output.txt");
		FileWriter fw = new FileWriter(fout,true);
		Queue q = new Queue();
		int i;
		char ch;
		for (i = 0; i < n; i++)
		{
			q.pushQ(charArray[i]);
		}
		i = 0;
		while (i<n)
		{
			ch = q.topQ();
			if(!Character.isDigit(ch))
			{
				fw.write(ch);
				fw.flush();
				q.popQ();
			}
			else
			{
				q.pushQ(ch);
				q.popQ();
			}
			i++;
		}
		while (!q.isNull())
		{
			ch = q.topQ();
			fw.write(ch);
			fw.flush();
			q.popQ();
		}
		fw.write("\r\n");
		fw.close();
		
	}

	public static void main(String[] args) throws Exception {
		
		File fin = new File("input.txt");
		File fout = new File("output.txt");
		FileWriter firstfw = new FileWriter(fout);
	    int maxW = 128;
		String[] file = new String[maxW];
		String s = new String();
		int i = 0;
		BufferedReader in;
		try{
			   in = new BufferedReader(new FileReader(fin));
			   while((s = in.readLine()) != null)
			   {
				   if(i < maxW)
				   {
					   file[i] = s;
				   }
				   i++;
			   }
			   in.close();
		}
		catch(IOException e){
			System.out.println("Error file: " + e);
			System.exit(0);
		}
		
		for(i = 0; i < maxW; i++)
		{
			if (file[i] != null)
			System.out.println(i + ")" + file[i]);
		}
		
		char [] charArray;
		int n = 0;
		firstfw.write("");
		for (i = 0; i < maxW; i++)
		{
			if (file[i]!=null)
			{
				charArray = file[i].toCharArray();
				n = file[i].length();
				doLine(charArray,n);
			}
		}
		firstfw.close();
		
	//q.destroy();
}
}
